package com.kuaixueit.crm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.kuaixueit.crm.common.ResultVO;
import com.kuaixueit.crm.pojo.QueryStaff;
import com.kuaixueit.crm.service.StaffService;

@Controller
@RequestMapping("staff")
public class StaffController {
  @Autowired
  private StaffService staffService;
  @RequestMapping("list")
  @ResponseBody
  public ResultVO list(@RequestParam(defaultValue="1")Integer page ,@RequestParam(defaultValue="8") Integer rows ,QueryStaff query){
      PageInfo info = new PageInfo();
      try {
        info = staffService.selectAll(page, rows, query);
      } catch (Exception e) {
        e.printStackTrace();
        return new ResultVO(null,null,false,"服务器内部错误，请联系管理员");
      }
      return new ResultVO(info.getTotal(), info.getList(), true, "查询成功");
    
  }
  
  
}
